package com.qiangesoft.mybatisflex.config;

import com.mybatisflex.annotation.UpdateListener;
import com.qiangesoft.mybatisflex.base.BaseEntity;

import java.time.LocalDateTime;

/**
 * 更新监听
 */
public class MyUpdateListener implements UpdateListener {

    @Override
    public void onUpdate(Object o) {
        if (o instanceof BaseEntity) {
            ((BaseEntity) o).setUpdateBy(1L);
            ((BaseEntity) o).setUpdateTime(LocalDateTime.now());
        }
    }

}